package com.ushio.commonmodule.pojo.result;

import java.util.ArrayList;
import java.util.List;

public enum ResultCode {
    SUCCESS(200, "调用成功"),
    FAIL(500, "调用失败"),
    SECURITY(503, "账号或者密码错误"),
    DEFAULT(10000, "默认返回");
    private int code;
    private String msg;

    public static ResultCode getByCode(int key) {
        ResultCode[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            ResultCode dot = var1[var3];
            if (key == dot.getCode()) {
                return dot;
            }
        }

        return DEFAULT;
    }

    public static ResultCode getByMsg(String value) {
        ResultCode[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            ResultCode dot = var1[var3];
            if (value.equals(dot.getMsg())) {
                return dot;
            }
        }

        return DEFAULT;
    }

    public static List<Integer> getAllCode() {
        List<Integer> list = new ArrayList();
        ResultCode[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            ResultCode dot = var1[var3];
            list.add(dot.getCode());
        }

        return list;
    }

    public static List<String> getAllMsg() {
        List<String> list = new ArrayList();
        ResultCode[] var1 = values();
        int var2 = var1.length;

        for(int var3 = 0; var3 < var2; ++var3) {
            ResultCode dot = var1[var3];
            list.add(dot.getMsg());
        }

        return list;
    }

    private ResultCode(int code, String msg) {
        this.code = code;
        this.msg = msg;
    }

    public int getCode() {
        return this.code;
    }

    public String getMsg() {
        return this.msg;
    }
}
